import variables from '@/styles/element-variables.scss';
import {
	title,
	showSettings,
	tagsView,
	fixedHeader,
	sidebarLogo
} from '@/settings';
import { ObjectUtil } from '@/utils/ObjectUtil';

const state = {
	theme: variables.theme,
	title,
	showSettings,
	tagsView,
	fixedHeader,
	sidebarLogo
};

const mutations = {
	CHANGE_SETTING: (state, { key, value }) => {
		if (ObjectUtil.has(state, key)) {
			state[key] = value;
		}
	}
};

const actions = {
	changeSetting({ commit }, data) {
		commit('CHANGE_SETTING', data);
	}
};

export default {
	namespaced: true,
	state,
	mutations,
	actions
};
